const xlsx = require("node-xlsx");
const path = require("path");
const uuid = require("uuid");

const rebates = require("../Rebates")

// 导入提成
const rebatesData = xlsx.parse(path.join( __dirname, "..", "..", "xlsx", "rebates.xlsx" ))[0].data;
const arr = [];
for(let i=1; i<rebatesData.length; i++){
  arr.push({
    rId: 'job-'+uuid.v1(),
    team: rebatesData[i][0],
    rebates: rebatesData[i][1]-0
  })
}
rebates.insertMany( arr ).then(()=>{
  console.log('提成导入成功');
})